<?php

/**
 * Created by PhpStorm.
 * User: zch
 * Date: 2017/7/20
 * Time: 9:28
 */
require_once "OperationAdd.php";
require_once "OperationDiv.php";
require_once "OperationMul.php";
require_once "OperationSub.php";

Class Factory
{
    static function createFactory($operate)
    {
        switch ($operate) {
            case "+":
                $obj = new OperationAdd();
                break;
            case "-":
                $obj = new OperationSub();

                break;
            case "*":
                $obj = new OperationMul();
                break;
            case "/":
                $obj = new OperationDiv();
                break;
            default:
                Throw new Exception("暂无此操作");
                break;
        }
        return $obj;
    }
}